import axios from "axios";
const server = axios.create({
  baseURL: "https://www.liulongbin.top:8888/api/private/v1",
  timeout: 10000,
});

// 请求拦截
server.interceptors.request.use(
  (config) => {
    if (localStorage.getItem("token")) {
      config.headers.Authorization = localStorage.getItem("token");
    }
    return config;
  },
  (err) => {
    Promise.reject(err);
  }
);

// 响应拦截

server.interceptors.response.use(
  (res) => {
    return res.data;
  },
  (err) => {
   console.log(err);
  }
);

export default server;
